use :: libc;
extern "C" {
    fn strrchr(_: *const i8, _: i32) -> *mut i8;
    fn vsnprintf(_: *mut i8, _: u64, _: *const i8, _: ::core::ffi::VaList) -> i32;
    fn snprintf(_: *mut i8, _: u64, _: *const i8, _: ...) -> i32;
    fn getprogname() -> *const i8;
    fn prctl(__option: i32, _: ...) -> i32;
}
pub type __builtin_va_list = [__va_list_tag; 1];
#[derive(Copy, Clone)]
#[repr(C)]
pub struct __va_list_tag {
    pub gp_offset: u32,
    pub fp_offset: u32,
    pub overflow_arg_area: *mut libc::c_void,
    pub reg_save_area: *mut libc::c_void,
}
pub type va_list = __builtin_va_list;
#[no_mangle]
pub unsafe extern "C" fn setproctitle(mut fmt: *const i8, mut args: ...) {
    let mut title: [i8; 16] = [0; 16];
    let mut name: [i8; 16] = [0; 16];
    let mut cp: *mut i8 = std::ptr::null_mut::<i8>();
    let mut ap: ::core::ffi::VaListImpl;
    let mut used: i32 = 0;
    ap = args.clone();
    vsnprintf(
        title.as_mut_ptr(),
        ::core::mem::size_of::<[i8; 16]>() as u64,
        fmt,
        ap.as_va_list(),
    );
    used = snprintf(
        name.as_mut_ptr(),
        ::core::mem::size_of::<[i8; 16]>() as u64,
        b"%s: %s\0" as *const u8 as *const i8,
        getprogname(),
        title.as_mut_ptr(),
    );
    if used >= ::core::mem::size_of::<[i8; 16]>() as u64 as i32 {
        cp = strrchr(name.as_mut_ptr(), ' ' as i32);
        if !cp.is_null() {
            *cp = '\0' as i32 as i8;
        }
    }
    prctl(15 as i32, name.as_mut_ptr());
}
